import pygame
import 配置
import random

class 背景类(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        大图片 = pygame.image.load(配置.图片路径['背景图片'])
        self.image1 = pygame.transform.scale(大图片.subsurface((0, 0), (1000, 1000)), (1000, 800))
        self.image2 = pygame.transform.scale(大图片.subsurface((0, 0), (1000, 1000)), (1000, 800))
        self.rect1 = self.image1.get_rect()
        self.rect1.x = 0
        self.rect1.y = 0
        self.rect2 = self.image2.get_rect()
        self.rect2.x = 995
        self.rect2.y = 0

    def draw(self,screen):
        screen.blit(self.image1,self.rect1)
        screen.blit(self.image2,self.rect2)

    def update(self):
        self.rect1.x -=1
        if self.rect1.x<-1000:
            self.rect1.x = 995
        self.rect2.x -=1
        if self.rect2.x < -1000:
            self.rect2.x = 995